#include "headfiles.h"

using namespace std;

int main(int argc, char **argv) {
    if (argc != 2) {
        cout << "Usage: " << argv[0] << " n" << endl;
        return 0;
    }

    int n = atoi(argv[1]);

    if (n <= 0) {
        cout << "Invalid input n, " << n << "." << endl;
        return 1;
    }

    int *array = (int *)malloc(sizeof(int) * n);
    if (array == NULL) {
        cout << "Allocate array buffer error!" << endl;
        return 1;
    }

    int i;
    for (i = 0; i < n; i++) {
        array[i] = i;
    }

    srand(time(NULL));

    int ret;
    ret = shuffleDeck(array, n);
    cout << "Shuffle output: " << endl;
    for (i = 0; i < n; i++) {
        cout << array[i] << endl;
    }

    return 0;
}

